package inabit.expressioncompiler.lexical;

import inabit.compiler.lexical.TokenClass;

/**The enumeration for all the token classes of the language*/
/**@author Rafael Rocha*/
public enum ExpressionTokenClass implements TokenClass{
	ID(),
	INT_CTE(),
	REAL_CTE(),
	STRING_CTE(),
	OPEN_PARENTHESIS("("),
	CLOSE_PARENTHESIS(")"),
	PLUS("+"),
	MINUS("-"),
	MULT("*"),
	DIV("/"),
	EXP("^"),
	COMMA(","),
	EOF();
	
	private boolean univoque;//a token class is univoque if it doesn't need a value
	private String idString;//the form that the token appears in the text
	private boolean isReservedWord;//return true if the token is a reserved word
	
	private ExpressionTokenClass(){
		univoque = false;
		isReservedWord = false;
		this.idString = toString();
	}
	private ExpressionTokenClass(String idString) {
		
		this.univoque = true;
		this.idString = idString;
		isReservedWord=false;
	}
	private ExpressionTokenClass(String idString, boolean isReservedWord) {
		
		this.univoque = true;
		this.idString = idString;
		this.isReservedWord=isReservedWord;
	}
	
	/**A token class is univoque if it doesn't need a value to be identified*/
	public boolean isUnivoque() {
		return univoque;
	}
	/**The representation form of the token on text*/
	public String getStateLabel() {
		return this.idString;
	}
	/**Returns <i>true</i> if the token is a reserved word on language*/
	public boolean isReservedWord() {
		return this.isReservedWord;
	}
	public String getID() {
		return this.toString();
	}
}
